<template>
  <el-dialog title="皮肤类型" width="40%" :before-close="dialogClose" :visible.sync="show">
      <el-form ref="form" label-width="50px">
          <el-radio v-model="skinCheck" label="干性">干性</el-radio>
          <el-radio v-model="skinCheck" label="混合性">混合性</el-radio>
          <el-radio v-model="skinCheck" label="油性">油性</el-radio>
          <el-radio v-model="skinCheck" label="过敏性">过敏性</el-radio>
          <div align="center" style="margin-top:20px;">
            <el-button type="primary" @click="userSubmit">确 定</el-button>
            <el-button @click="dialogClose">取 消</el-button>
          </div>
      </el-form>
  </el-dialog>
</template>
 
<script>
export default {
  name: 'skinList',
  props:['show','id','mySkin'],
  data() {
    return {
        skinArr:[],
        remark:'',
        skinCheck:this.mySkin,
        info:{},
        member_id:0
    }
  },
  watch: {
      //正确给 cData 赋值的 方法
      mySkin: function(newVal,oldVal){
          this.skinCheck = newVal;  //newVal即是chartData
      }
  },
  created: function(){
    
  },
  methods: {
    dialogClose:function(){
      this.$emit("func",{'key':'skinType'})
    },
    userSubmit:function(){
      if(!this.skinCheck){
          this.$message.error('请选择皮肤类型');
          return;
      }
      var data = {
        name:this.skinCheck,
				oa_id:localStorage.getItem('oa_id'),
				member_id:this.id,
				user_id:localStorage.getItem('company_uid')
      }
      var that = this
      this.$post('manage/skin/typeAdd',data).then((res) => {
          if(res.code == 1){
            that.$message.success(res.msg);
            that.$emit("func",{'key':'skinType','value':data.name,'type':1})
          }else{
            that.$message.error(res.msg);
          }
      })
    }
  }
}
</script>
<style>
.skinList_checkbox{
    display: flex;
    flex-direction:row;
    justify-content:flex-start;
    flex-wrap:wrap;
}
.skinList_checkbox label{
  margin-top:20px;
}
.el-checkbox.is-bordered:first-child{
  margin-left:10px;
}
</style>